// components/popup/popup.js
import user from '../../utils/user.js'
Component({
    options: {
        addGlobalClass: true
    },
    /**
     * 组件的属性列表
     */
    properties: {
        time: String,
    },

    /**
     * 组件的初始数据
     */
    data: {
        bottom: 0,
        isover:false
    },

    ready(){
        var datenow = new Date().getTime()
        var datecurrent = new Date(this.properties.time).getTime()
        if (datecurrent<datenow) {
            this.setData({
                isover:true
            })
        }else{
            this.setData({
                isover:false
            })
        }
        wx.onKeyboardHeightChange(res=>{
            console.log(res)
            this.setData({
                bottom: res.height / 2
            })
        })
    },

    /**
     * 组件的方法列表
     */
    methods: {
        close() {
            user.expireStatus = true
            this.triggerEvent('cancel')
        },
        goRenew(){
            wx.navigateTo({
                url: '/packageInsurance/pages/insurance-recharge-bullet/insurance-recharge-bullet?type=payRenew'
            })
            this.close()
        }
    }
})
